
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.UnknownHostException;

import com.almworks.sqlite4java.SQLiteConnection;
import com.almworks.sqlite4java.SQLiteException;
import com.almworks.sqlite4java.SQLiteStatement;

import task.*;


public class main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("main running.");

//		Controller c = new Controller();
//		c.readConfig();

//		Controller c = new Controller();
//		c.writeConfig();
		
//		Type a = Integer.TYPE;
//		System.out.println(a.toString());
		
//		TaskBase task = new TaskArraySequentialRead("123", "test1", 1);
//		task.setWorkingset(new WorkingsetArrayInt(100, 10));
//		task.run();
		
//		AbstractTask t = new TaskArrayIntSequentialRead(5, 102, 1);
//		t.run();
		
//		TaskControllor tc = new TaskControllor();
//		tc.init();
		
		
//		try {
//			Class c = Class.forName("task.TaskRunnerAverage");
//			Constructor ctor = c.getDeclaredConstructor(AbstractTask.class);
//			//ctor.setAccessible(true);
//			try {
//				AbstractTaskRunner tr = (AbstractTaskRunner) ctor.newInstance(new TaskArrayIntSequentialRead(10, 1000, 10));
//				tr.runTask();
//			} catch (InstantiationException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			} catch (IllegalAccessException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			} catch (IllegalArgumentException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			} catch (InvocationTargetException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		} catch (NoSuchMethodException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		} catch (SecurityException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		} catch (ClassNotFoundException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		}
		
		
//		try {
//			Class c = Class.forName("task.TaskRunnerAverage");
//			AbstractTaskRunner tr = (AbstractTaskRunner) c.newInstance();
//			tr.runTask();
//			
//		} catch (ClassNotFoundException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (InstantiationException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (IllegalAccessException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//		
//		TaskControllor tc = new TaskControllor();
////		tc.initTaskRunner(new File("resources/config.properties"));
////		tc.run();
//		
//		tc.initTasks(new File("resources"));
//		tc.showMeSomething();
		
		
//		try {
//			SQLiteConnection db = new SQLiteConnection(new File("resources/result.db"));
//			db.open(true);
//			SQLiteStatement st = db.prepare("select * from result");
//			while(st.step()) {
//				for(int i = 0; i < st.columnCount(); i++) {
//					System.out.print(st.columnValue(i) + ", ");					
//				}
//			}
//		} catch (SQLiteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
		
		
//		TaskControllor tc = new TaskControllor();
//		tc.initTaskRunner(new File("resources/config.properties"));
//		tc.initTasks(new File("resources"));
//		tc.run();
		
		AbstractTask task = new TaskArrayIntSequentialread();
		task.setStride(1);
		task.setWorkingsetSize(100);
		
		AbstractTaskRunner tr = new TaskRunnerAverage();
		tr.setRunningTime(1000);
		tr.setTask(task);
		
		tr.runTask();
		
		
	}

}
